home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / SmallEiffel 0.3.3 / SmallEiffel 68k / lib_test / test_integer1.e < prev    next >
Encoding:
Text File  |  1996-06-13  |  2.3 KB  |  118 lines  |  [TEXT/EDIT]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_INTEGER1
  5.  
  6. creation make
  7.    
  8. feature 
  9.    
  10.    make is
  11.       local
  12.      i: INTEGER;
  13.       do
  14.      is_true(1 = 1);
  15.      is_true(0 = 0);
  16.      is_true(-1 = -1);
  17.      is_true(0 + 1 = 1);
  18.      is_true(1 = 1 + 0);
  19.      is_true(0 - 1 = -1);
  20.      is_true(-1 = - 1 + 0);
  21.      
  22.      is_true(2 + 2 = 4);
  23.      is_true(2 + 2 /= 3);
  24.      is_true(2 * 2 = 4);
  25.      is_true(4 = 2 * 2);
  26.      
  27.      i := 76;
  28.      is_true(76 = i);
  29.      is_true(i + 1 = 77);
  30.      is_true(76 = i);
  31.      
  32. --     is_true(9 / 2 = 4);
  33.      is_true(9 \\ 2 = 1);
  34.      
  35.      is_true(2 ^ 0 = 1);
  36.      is_true(2 ^ 1 = 2);
  37.      is_true(2 ^ 2 = 4);
  38.      is_true(2 ^ 3 = 8);
  39.      
  40.      is_true(3 ^ 0 = 1);
  41.      is_true(3 ^ 1 = 3);
  42.      is_true(3 ^ 2 = 9);
  43.      is_true(3 ^ 3 = 27);
  44.      
  45.      is_true(-3 < -1);
  46.      is_true(-1 < 0);
  47.      is_true(-1 < 1);
  48.      is_true(0 < 1);
  49.      is_true(1 < 2);
  50.  
  51.      is_true(-3 <= -1);
  52.      is_true(-3 <= -3);
  53.      is_true(-1 <= 0);
  54.      is_true(-1 <= 1);
  55.      is_true(-1 <= -1);
  56.      is_true(0 <= 1);
  57.      is_true(1 <= 2);
  58.      is_true(2 <= 2);
  59.      
  60.      is_true(not (3 <= 2));
  61.       
  62.      is_true(3 = +3);
  63.      is_true(+3 = +(1 + 2));
  64.       
  65.            is_true(-3 = 3-6);
  66.      
  67.      is_true(("0").is_equal((0).to_string));
  68.      is_true(("25").is_equal((25).to_string));
  69.      is_true(("-25").is_equal((-25).to_string));
  70.      
  71.      is_true((" 25").is_equal((25).to_string_format(3)));
  72.      is_true((" -25").is_equal((-25).to_string_format(4)));
  73.  
  74.      is_true('0' = (0).digit);
  75.      is_true('5' = (5).digit);
  76.      is_true('9' = (9).digit);
  77.       
  78.            is_true(' ' = (32).to_character);
  79.      
  80.      is_true((-25).abs = 25);
  81.      is_true((25).abs = 25);
  82.      
  83.      is_true((3).max(4) = 4);
  84.      is_true((4).max(3) = 4);
  85.       
  86.      is_true((3).min(4) = 3);
  87.      is_true((4).min(3) = 3);
  88.       
  89.      is_true((-2).min(2) = -2);
  90.      is_true((2).max(-2) = 2);
  91.       
  92.      is_true((0).to_octal = 0);
  93.      is_true((7).to_octal = 7);
  94.      is_true((8).to_octal = 10);
  95.      is_true((9).to_octal = 11);
  96.      is_true((-10).to_octal = -12);
  97.      is_true(400 = (256).to_octal);
  98.      is_true(-400 = (-256).to_octal);
  99.      is_true(377 = (255).to_octal);
  100.      is_true(177 = (127).to_octal);
  101.       end;
  102.    
  103.    is_true(b: BOOLEAN) is
  104.       do
  105.      cpt := cpt + 1;
  106.      if not b then
  107.         std_output.put_string("TEST_INTEGER1: ERROR Test # ");
  108.         std_output.put_integer(cpt);
  109.         std_output.put_string("%N");
  110.      else
  111.         -- std_output.put_string("Yes%N");
  112.      end;
  113.       end;
  114.    
  115.    cpt: INTEGER;
  116.    
  117. end -- TEST_INTEGER1
  118.